<!-- Da hoan thanh co ban viec comment, tuy nhien co hien tuong bi vo layout va avatar chua hoan chinh 
Chua the phan trangng-->

<?php 
	/*
	 * Trieu: Giup cho viec tuong thich he thong
	 */
	if (isset($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
		die ('Please do not load this page directly. Thanks!');
?>

<?php if(have_comments()):?>
	<?php foreach ($comments as $comment):?> <!-- begin foreach comment -->

	 <div class="question-answer"> <!-- #question-anwser -->
			<div class="question-answer-title">
				<div class="question-user-img-nobg">
					<!-- Lay avatar cua user  -->
					<?php echo  get_avatar($comment, 32, 
							get_bloginfo('template_directory')."/images/no_avatar.gif")?>
				</div>
				<div class="answer-by">
					<p><?php comment_author();?></p>
					<p class="answer-date-2"><?php comment_time ('F jS, Y')?></p>
				</div>
				<div></div>
				<div style="clear:both;"></div>
			</div>
		 <div class="answer-content">
			<?php comment_text();?>
		 </div>
		 <img src="<?php echo get_bloginfo('template_directory');?>/images/answer-bg-bottom.jpg" />
	 </div> <!-- #question-anwser -->
	 

	<?php endforeach;?> <!-- //end foreach cac comment -->    

<?php endif;?>

<?php previous_comments_link("Pre"); echo "<br>";next_comments_link("Next", 4)?>
        

 <?php if ('open' == $post->comment_status && $user_ID):?> <!-- #begin if : option cho phep view va userID > 0 -->
	 <!-- Them moi 1 comment -->
	 <div class="answer-post">
	 	<a name="ANSWER_THIS_QUESTION"></a> <!-- Danh dau trang -->
		<p>Answer this question</p>
	</div>
	
	<div id="cancel-comment-reply"> 
      <small><?php cancel_comment_reply_link() ?></small>
    </div>
	
	<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
		 <?php comment_id_fields(); ?> <!-- them vao 1 so hidden field cho form nhap comment -->
		   
		<div class="text-publish">
			<textarea name="comment" id="comment" cols=75 rows=6></textarea>
		</div>
		<input class="publish-btn" type="image" name="sudmit" id="submit" 
				src="<?php echo get_bloginfo('template_directory');?>/images/publish.jpg"
				 value="Submit Comment"/>
		 <?php do_action('comment_form', get_the_ID()); ?>  <!-- Add comment -->
	</form>

<?php endif;?> <!-- //endif -->
        